This example creates an RDSServer.DataFactory object using the CreateObject method of the RDS.DataSpace object. To test this example, cut and paste this code between the <Body></Body> tags in a normal HTML document and name it ADCapi7.asp. ASP script will identify your server.
<H2>RDS API Code Examples</H2>
<HR>
<H3>Using Query Method of RDSServer.DataFactory</H3>
<!-- RDS.DataSpace ID RDS1-->
<OBJECT ID="RDS1" WIDTH=1 HEIGHT=1
CLASSID="CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36">
</OBJECT>
<!-- RDS.DataControl with parameters
set at run time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=RDS WIDTH=1 HEIGHT=1>
</OBJECT>
<TABLE DATAsrc=#rds>
<TBODY>
<TR>
<TD><SPAN DATAFLD="FirstName"></SPAN></TD>
<TD><SPAN DATAFLD="LastName"></SPAN></TD>
</TR>
</TBODY>
</TABLE>
<HR>
<INPUT TYPE=BUTTON NAME="Run" VALUE="Run">
<BR>
<H4>Click Run. The CreateObject Method of the
RDS.DataSpace Object Creates an instance of the
RDSServer.DataFactory.
The Query Method of the RDSServer.DataFactory is used
to bring back a Recordset. </H4>
<Script Language="VBScript">
<!--
Dim DF
Dim strServer
Dim strConnect
Dim strSQL
strServer = "http://<%=Request.ServerVariables("SERVER_NAME")%>"
strConnect = "Provider=SQLOLEDB;User Id=rdsdemo;Password=rdsdemo;Initial Catalog=AddrBookDB"
strSQL = "Select * from Employee"
Sub Run_OnClick()
' Create RDSServer.DataFactory Object
Dim objADORs
' Get Recordset
Set DF = RDS1.CreateObject("RDSServer.DataFactory", strServer)
Set objADORs = DF.Query(strConnect, strSQL)
' Set parameters of RDS.DataControl at Run Time
RDS.Server = strServer
RDS.SQL = strSQL
RDS.Connect = strConnect
RDS.Refresh
End Sub
-->
</Script>